package com.hspedu.enum_;

/**
 * @Author Stringzhua
 * @Date 2024/3/6 20:14
 * description:
 */
public class Enumeration03 {
    public static void main(String[] args) {
        System.out.println(Season02.SPRING);
        System.out.println(Season02.SUMMER);
        System.out.println(Season02.AUTUMN);
        System.out.println(Season02.WINTER);
    }
}

//演示使用enum关键字来实现枚举类
enum Season02 {//类
    //    //3.定义了四个对象,固定
//    public static final Season SPRING =new Season("春天", "温暖");
//    public static final Season WINTER =new Season("冬天", "寒冷");
//    public static final Season AUTUMN =new Season("秋天", "凉爽");
//    public static final Season SUMMER =new Season("夏天", "炎热");
    //如果使用了enum来实现枚举类
    //1.使用关键字enum替代class
    //2.public static final Season SPRING =new Season("春天", "温暖")直接使用 SPRING("春天", "温暖")替代
//    SPRING("春天", "温暖"); //解读：常量名(实参列表)
    //3.如果有多个常量,使用,间隔即可
    //4.如果使用enum 来实现枚举,要求将定义常量对象,写在前面
    //5.如果我们使用的是无参构造器,创建常量对象,则可以省略()
//    //枚举对象必须放在枚举类的行首
//    SPRING("春天", "温暖"), WINTER("冬天", "寒冷"), AUTUMN("秋天", "凉爽"),
//    SUMMER("夏天", "炎热"), What();
    SPRING("春天", "温暖"), WINTER("冬天", "寒冷"), AUTUMN("秋天", "凉爽"),
    SUMMER("夏天", "炎热");
    private String name;//季节
    private String desc;//描述

    private Season02() {//无参构造器

    }

    private Season02(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

//    public void setName(String name) {
//        this.name = name;
//    }

    public String getDesc() {
        return desc;
    }

//    public void setDesc(String desc) {
//        this.desc = desc;
//    }

    @Override
    public String toString() {
        return "Season02{" +
                "name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                '}';
    }
}